home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 26
/
Cream of the Crop 26.iso
/
bbs
/
mxgui203.zip
/
GUI_FONT.TXT
< prev
next >
Wrap
Text File
|
1997-08-12
|
8KB
|
157 lines
{
───────────────────────────────────────────────────────────────────────────────
▀▀▀ ▀▀▀ ▀▀▀▀▀ ▀▀ ▀▀
▀▀▀▀ ▀▀▀▀ ▀▀ ▀▀ ▀▀ ▀▀
▀▀ ▀▀▀ ▀▀ ▀▀▀▀▀▀▀ ▀▀▀ ╔══ ╦═╗ ╔═╗ ╦═╗ ╦ ╦ ╦ ╔═╗ ╔═╗
▀▀ ▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ║ ╦ ╠╦╝ ╠═╣ ╠═╝ ╠═╣ ║ ║ ╚═╗
▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ▀▀ ╚═╝ ╩╚═ ╩ ╩ ╩ ╩ ╩ ╩ ╚═╝ ╚═╝
───────────────────────────────────────────────────────────────────────────────
The MAX Graphics GUI Kit is Copyright 1995-Current Larry L. Athey (LA-Soft).
Color Averaging procedures are courtesy of Sean Price (Rude Dog Software).
───────────────────────────────────────────────────────────────────────────────
This unit provides facilities for using the GEM format bitmapped fonts in
programs that use the FastGraph graphics library. GEM fonts are used in a
lot of programs such as: NeoSoft products, MAX Graphics products, and any
program written using the GX-Text kit by Genus Microprogramming.
GEM fonts may be loaded from files during program execution or they may be
linked into the .EXE file. This requires converting the font to an .OBJ file
using BINOBJ and then creating a .TPU file following the same procedures for
BGI drivers and fonts in Borland's slowpoke BGI interface. Refer to the file
GUI_UNIT.PAS, PROCEDURE LoadGemFonts; for more details.
GEM fonts are manipulated by identifiers in the form of pointers.
The same color settings and text settings that control the use of BGI fonts
in Borland's slowpoke BGI also control the use of GEM fonts, with these few
differences:
A. The normal BGI text settings for font and size are ignored. GEM fonts are
always drawn at their native size.
B. Two text directions in addition to the two available for BGI fonts can
be specified in a call to GEMFONTU's SetTextDirection. They are:
0 - Horizontal, normal left to right text output.
1 - Vertical, normal bottom to top text output.
2 - Vertical, from top to bottom, rotated 90 degrees clockwise. For this
direction, left justification means that the top (beginning) of the
text is at the current position, center justification means that half
the text is above the current position and half below, and right
justification means that the bottom (end) of the text is at the
current position.
3 - Vertical, from top to bottom, without rotation. The meaning of
justification is the same as for 2. The "Vert" setting is interpreted
as applying to the horizontal positioning of the characters relative
to the X coordinate of the current position. TopText causes the left
edges of the characters to be aligned at X. CenterText causes the
characters to be centered at X. BottomText causes the right edges of
the characters to be aligned at X.
NOTE: Due to improper techniques used by some people in creating
GEM fonts, some of the above modes may not work correctly.
──────────────────────────────────────────────────────────────────────────────}
INTERFACE
TYPE
TWordArray0 = ARRAY[0..32766] OF WORD;
PWordArray0 = ^TWordArray0;
TByteArray0 = ARRAY[0..65534] OF BYTE;
PByteArray0 = ^TByteArray0;
TExtendedGEMFontHeader = RECORD
CharacterOffsetTablePtr : PWordArray0; { Extended portion begins here }
FontDataPtr : PByteArray0;
AllocatedBytes : WORD;
FontID : WORD; { True font header begins here }
PointSize : WORD;
FontName : ARRAY[0..31] OF CHAR;
LowASCII : WORD;
HighASCII : WORD;
Top : INTEGER;
Ascent : INTEGER;
Half : INTEGER;
Descent : INTEGER;
Bottom : INTEGER;
WidestCharacterWidth : WORD;
WidestCellWidth : WORD;
LeftOffset : INTEGER;
RightOffset : INTEGER;
Thickness : WORD;
UnderscoreThickness : WORD;
LightTextMask : WORD;
ItalicTextMask : WORD;
Flags : WORD;
HorizontalOffsetTableOffset : LONGINT;
CharacterOffsetTableOffset : LONGINT;
FontDataOffset : LONGINT;
SpanWidth : WORD;
Height : WORD;
NextFontOffset : LONGINT
END;
PExtendedGEMFontHeader = ^TExtendedGEMFontHeader;
PROCEDURE SetTextDirection(D : WORD);
{^Sets the direction of the text to be displayed. Refer to the description
in the introductory comments in the above for more details. }
FUNCTION GEMTextHeight(GEMFontID : POINTER; TextString : STRING) : WORD;
{^If GEMFontID is a valid identifier of a GEM font, this function returns
the character height of TextString in pixels when drawn in font GEMFontID.
(The character height is identical with the cell height of the font.)
Otherwise the function returns 0. (The function makes no use of TextString,
since the cell height is an attribute of the font. TextString is included
simply for symmetry with the TextWidth function.) }
FUNCTION GEMTextWidth(GEMFontID : POINTER; TextString : STRING) : WORD;
{^If GEMFontID is a valid identifier of a GEM font, this function returns
the width of TextString in pixels when drawn in font GEMFontID. Otherwise
it returns 0. }
FUNCTION LoadGEMFont(FontFileName : PathStr; VAR Leading, ErrorCode : WORD) : POINTER;
{^This function loads a GEM font from file FontFileName, sets Leading to the
cell height of the font and ErrorCode to 0, and returns an identifier for
the font. If, however, an error occurs during the attempt to load the font,
the function returns NIL with ErrorCode set to one of these codes:
1 - The file is too large for LoadGEMFont to process.
2 - There isn't enough heap memory to store the font.
3 - The file doesn't contain a GEM font. }
PROCEDURE OutGEMText(GEMFontID : POINTER; TextString : STRING);
{^If GEMFontID is a valid identifier of a GEM font, TextString is drawn at
the current position in that font. The text is clipped at the boundaries
of the screen. The current position is updated only if the direction is
horizontal and justification is left (if the direction is left to right)
or right (if the direction is right to left). However, if GEMFontID isn't
a valid identifier, no action is taken. }
PROCEDURE OutGEMTextXY(GEMFontID : POINTER; X, Y : INTEGER; TextString : STRING);
{^Like OutGEMText,except that the text is drawn at position (X,Y) rather than
the current position. Also, the current position isn't updated under any
circumstances. }
FUNCTION RegisterGEMFont(LinkedGEMFontPtr : POINTER; VAR Leading, ErrorCode : WORD) : POINTER;
{^LinkedGEMFontPtr is the address of the external name of a GEM font that was
linked into the .EXE file from a unit. The function returns an identifier
for the font, sets Leading to the cell height of the font, and sets
ErrorCode to 0. However, if an error is detected, the function returns NIL
with Leading set to 0 and ErrorCode set to one of these codes:
1 - LinkedGEMFontPtr is NIL.
2 - There isn't enough heap memory for the control information created
by the function.
3 - LinkedGEMFontPtr doesn't point to a GEM font. }
PROCEDURE UnloadGEMFont(VAR GEMFontID : POINTER);
{^The GEM font identified by GEMFontID is removed from memory and GEMFontID
is set to NIL. }
{──────────────────────────────────────────────────────────────────────────────}